<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<title>交易文件上传</title>

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type="text/javascript">

	function loaddate(){
	  
	   var merchantId = $("#dateFlag").val();
	   if(merchantId==1){
	     document.getElementById("workdate").style.display="block";
	     document.getElementById("holiday").style.display="none";
	   }
	   if(merchantId ==2){
	      document.getElementById("workdate").style.display="none";
	     document.getElementById("holiday").style.display="block";
	   }
	}
	
	 $(document).ready(function(){
       document.getElementById("workdate").style.display="block";
	   document.getElementById("holiday").style.display="none";
	   
	   	$("#queryButton").click(
						function() {
							var merchantId = $("#dateFlag").val();
							if(merchantId==''){
							  alert("请选择对账日期类型！");
									return false;
							}
							if(merchantId == 1){
							var workDate = $("#workDate").val();
							    if(workDate==''){
								    alert("日期不能为空！");
									return false;
							    }
								
							}
							if(merchantId == 2){
							    var minDate = $("#minDate").val();
							    var maxDate = $("#maxDate").val();
							    if(minDate==''||maxDate==''){
								    alert("日期不能为空！");
									return false;
							    }
							}
							var fileName = $("#fileName").val();
							if(fileName==''){
							  alert("请上传对账文件！");
									return false;
							}
							
							$("#queryUserForm").submit();
						});
	   
	   
   });
   
   
	
</script>
</head>
<body>
	<div class="subpage">
		<s:form id="uploadForm" action="upload.ct" method="post"
			namespace="/fina" enctype="multipart/form-data" theme="simple">
			<div class="user_title">
				<h2 class="headline-inquires">
					POS收单运营管理平台<br />
					<span class="sub-title"></span>
				
				</h2>
			</div>
			<table width="100%" cellpadding="0" cellspacing="0" border="0"
				class="query_table">

				<tr>
					<td colspan="4" align="center">
						<h2 class="headline-inquires">
							对账文件导入<br /> <span class="sub-title"></span>
						</h2>

					</td>
				</tr>

				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
				<tr>
					<td align="right">对账日期类型：</td>
					<td  abbr="left" colspan="1">
						   <s:select cssClass="queryWidth" name="dateFlag"  onchange="loaddate()"  
								id="dateFlag"
								list="#{'1':'工作日','2':'节假日'}" headerKey="" headerValue="--请选择--" /> 
								
					</td>
						<td align="right">对账日期：</td>
						<td align="left" colspan="1">
							<div id="holiday">
								<s:textfield id="minDate"
									name="minDate"
									onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"
									theme="simple" cssClass="queryWidth" /> 至：<s:textfield id="maxDate" 
									name="maxDate"
									onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"
									theme="simple" cssClass="queryWidth" />
							</div>
						    <div id="workdate">
						    	<s:textfield id="workDate"
									name="finaDate"
									onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"
									theme="simple" cssClass="queryWidth" />
							</div>		
					</td>
				</tr>

				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
				<tr>
					<td align="right">对账文件：</td>
					<td align="left" colspan="3"><s:file id="fileName" name="upload" size="100"></s:file></td>
				</tr>
			
				<tr>
					<td colspan="4">&nbsp;<s:token></s:token></td>
				</tr>
				<tr>
					<td colspan="4" align="center"><div style="color: blue;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div></td>
				</tr>

				<tr>
					<td colspan="4" align="center"><s:submit value="确   认"
							id="queryButton" /> &nbsp;&nbsp;&nbsp;&nbsp; <s:reset
							value="取  消" /></td>
				</tr>
				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
			</table>

		</s:form>
	</div>
</body>
</html>